package cn.xd.itstack.springframework.context.event;

import cn.xd.itstack.springframework.beans.factory.BeanFactory;
import cn.xd.itstack.springframework.context.ApplicationEvent;
import cn.xd.itstack.springframework.context.ApplicationListener;

/**
 * @Classname SimpleApplicationEventMulticaster
 * @Description TODO
 * @Date 2022/5/28 下午3:51
 * @Created by lvxiaodong
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster {

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory){
        setBeanFactory(beanFactory);
    }

    @Override
    public void multicastEvent(ApplicationEvent event) {
        for (final ApplicationListener listener : getApplicationListeners(event)) {
            listener.onApplicationEvent(event);
        }
    }
}
